var loginFn = require("./login/index.js")
var registerFn = require("./register/index.js")
var orderFn = require("./order/index.js")
var goodsFn = require("./goods/index.js")
var othersFn = require("./others/index.js")

var http = require("http");
var host = "127.0.0.1"
var port = "8080"
var server = http.createServer();
server.on("request",(request,response)=>{
    var path = request.url.split("?")[0];
    switch(path){
        case "/login": 
            loginFn(request,response); 
        break;
        case "/register": 
            registerFn(request,response);
        break;
        case "/order": 
            orderFn(request,response);
        break;
        case "/goods": 
            goodsFn(request,response);
        break;
        default:
            othersFn(request,response);
    }
})
server.listen(port,host,()=>{
    console.log("server is runing on http://127.0.0.1:8080")
})